<?php
function PricerrTheme_post_new_area_function() {
	global $current_user;
	get_currentuserinfo();
	$uid = $current_user->ID;
	$PricerrTheme_post_new_page_id = get_option('PricerrTheme_post_new_page_id');

	//-*******************************************************************************
	$pid = $_GET['jobid'];
	global $post_PID, $post_new_error, $adOK;
	$post_PID = $pid;
	$post = get_post($pid);
	//$location 	= wp_get_object_terms($pid, 'job_location');
	//$cat 			= wp_get_object_terms($pid, 'job_cat');	
		
	global $current_user;
	get_currentuserinfo();
	$cid = $current_user->ID;
	$post = get_post($pid);	
	//-*********************************************************************************
	//$shipping 	= trim($_POST['shipping']);
	//$max_days	= trim($_POST['max_days']);
	$ttl = (empty($_SESSION['i_will']) ? $post->post_title : $_SESSION['i_will']);    //seems duplicating what is following


	$ttl = (empty($_SESSION['i_will']) ? 
	($post->post_title == "Auto Draft" ? "" : get_post_meta($post->ID,'title_variable',true)) : $_SESSION['i_will']); ?>
			
	<div id="content">
		<div class="box_title"><?php echo __("Issue New Invitation", 'PricerrTheme'); ?></div>
		<div class="box_content">
		<?php  // validation, if required field is empty    
				if(is_array($post_new_error))
				if($adOK == 0)
				{
					echo '<div class="errrs">';
						foreach($post_new_error as $e)		
						echo '<div class="newad_error">'.$e. '</div>';	
					echo '</div>';
				}
		?>
		
		<ul class="post-new">
 		<form method="post" enctype="application/x-www-form-urlencoded" action="<?php echo PricerrTheme_post_new_with_pid_stuff_thg($pid);?>">    

			<li>
				<h2><?php echo __('For reserve', 'PricerrTheme'); ?>:</h2>
				<p><input type="text" size="40" class="do_input" name="the_sale" 
					value="<?php echo $ttl; ?>" /> <span><?php _e("at each","PricerrTheme"); ?> 
					<?php // budget free_input or dropdown values                            
					$PricerrTheme_enable_free_input_box 	= get_option('PricerrTheme_enable_free_input_box');
					$PricerrTheme_enable_dropdown_values 	= get_option('PricerrTheme_enable_dropdown_values');
					$x = (isset($_POST['price']) ? $_POST['price'] : $_SESSION['price']);
					if($PricerrTheme_enable_free_input_box == "yes") {
						echo PricerrTheme_get_currency();
						echo ' <input type="text" name="price" class="do_input" value="'.$_SESSION['price'].'" size="5" /> ';                               
					}
					elseif($PricerrTheme_enable_dropdown_values == "yes")
						echo PricerrTheme_get_variale_cost_dropdown('do_input', $x);
					else		
						echo PricerrTheme_get_show_price(get_option('PricerrTheme_job_fixed_amount'));
					 ?></span> 
				</p>
		  
			<!-- Don't need input category, for the moment -->
	
			<li><h2><?php echo __('Description', 'PricerrTheme'); ?>:</h2>
					<p><textarea rows="6" cols="45" class="do_input"  name="rsvp_description"><?php 
					echo empty($_POST['rsvp_description']) ? trim($post->post_content) : htmlspecialchars($_POST['rsvp_description']); ?></textarea><br/>
					<?php _e('Min: 100 chars. Max: 500','PricerrTheme'); ?> </p>
			</li> 
                                
			<?php // $instruction_box = get_post_meta($pid, 'instruction_box', true); // Not using post_meta anymore ?>
			<li><h2><?php echo __('Instructions to buyer', 'PricerrTheme'); ?>:</h2>
					<p><textarea rows="6" cols="45" class="do_input"  name="instruction_box"><?php 
					echo empty($_POST['instruction_box']) ? trim($instruction_box) : htmlspecialchars($_POST['instruction_box']); ?></textarea></p>
			</li>
									
			<!-- input for PAY BEFORE DATE of this invitation -->                           
			<!-- input for EFFECTIVE DATE of exercising the deal -->
			<!-- input for END DATE of the deal -->

			<!-- no need for categories or taxonomies ? -->
			
			<!-- Disabled:Image as post attachment -->
																							
			<li>
			<!-- "Post Job" the button -->
			<p><input type="submit" name="Pricerr_post_new_job" value="<?php _e("Issue Invitation", 'PricerrTheme'); ?>" /></p>
			</li>
                        
		</form>
		</ul>
        </div> <!-- box content -->
    </div> <!-- content-->
    
    <!-- widgets -->
    
    <div id="right-sidebar">    
        <ul class="xoxo">
                 <?php dynamic_sidebar( 'other-page-area' ); ?>
        </ul>    
    </div>
<?php
}
?>
